Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figma: People Page Violates The Figma Style Guide #3171 #3274

Closed

Conversation

abhassen44
Copy link

@abhassen44 abhassen44 commented Jan 14, 2025

What kind of change does this PR introduce?

bugfix, feature, refactoring

3171

Fixes #3171

2025-01-14.15-32-54.mp4

If relevant, did you update the documentation?

no

Summary
it refacors design of menu and components of menu

Does this PR introduce a breaking change?

no

Checklist

CodeRabbit AI Review

  • I have reviewed and addressed all critical issues flagged by CodeRabbit AI
  • I have implemented or provided justification for each non-critical suggestion
  • I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

Test Coverage

  • I have written tests for all new changes/features
  • I have verified that test coverage meets or exceeds 95%
  • I have run the test suite locally and all tests pass

Have you read the contributing guide?

yes

Summary by CodeRabbit

Release Notes

  • Dependency Updates

    • Added gulp-header dependency
    • Updated typedoc and typedoc-plugin-markdown
    • Added eslint-config-react-app
    • Introduced overrides section in dependency management
  • UI/UX Improvements

    • Enhanced button and icon styling across multiple components
    • Updated left drawer and organization list component styles
    • Refined color schemes and visual interactions
    • Added new styles for the .btn-success class
  • Code Quality

    • Improved type safety in components
    • Refactored modal management
    • Updated pre-commit hook configuration
    • Streamlined error handling and output messages in scripts
  • Access Control

    • Added conditional rendering for organization creation button based on user privileges
  • Performance

    • Optimized component rendering and state management
    • Improved specificity of linting checks in workflow

Copy link
Contributor

coderabbitai bot commented Jan 14, 2025

Walkthrough

This pull request introduces a series of modifications across multiple files in the Talawa Admin project. The changes primarily focus on styling updates, dependency management, and minor refactoring of components. Key modifications include updates to CSS variables, adjustments in color schemes, improvements in component styling, and updates to package dependencies. The changes aim to enhance the visual consistency and maintainability of the application, with a particular emphasis on adhering to the Figma design guidelines.

Changes

File Change Summary
.husky/pre-commit Modified pre-commit hook to comment out npm run lint:fix and uncomment npm run lint-staged
package.json Added overrides section with specific package versions and removed certain devDependencies
src/assets/css/app.css Updated .btn-success styles with new color, hover, and active states
src/components/CheckIn/TableRow.tsx Modified PDF blob generation in generateTag function
src/components/CollapsibleDropdown/CollapsibleDropdown.tsx Updated color and text styles for dropdown states
src/components/LeftDrawer/LeftDrawer.tsx Modified button and icon colors for active states
src/components/LeftDrawerOrg/LeftDrawerOrg.module.css Added new CSS module with comprehensive styling for left drawer
src/components/LeftDrawerOrg/LeftDrawerOrg.tsx Refined drawer visibility and organization data logic
src/screens/OrgList/OrgList.tsx Added conditional rendering for "Create Organization" button for super admins
src/screens/OrganizationPeople/AddMember.tsx Introduced useModal hook, updated modal management
src/screens/OrganizationPeople/OrganizationPeople.tsx Added row numbering, updated sorting functionality
src/style/app.module.css Updated CSS variables for shadows and colors
src/screens/EventManagement/EventManagement.tsx Added type declaration for URL parameters
.github/workflows/pull-request.yml Added filtering step for TypeScript files in the GitHub Actions workflow
.github/workflows/scripts/eslint_disable_check.py Refined error handling and output messages in the linting script
matrix.txt Added a new matrix of integers

Assessment against linked issues

Objective Addressed Explanation
Conform to Figma Style Guide [#3171]
Use variables in src/style/app.module.css
Migrate away from green theme

Possibly related issues

Possibly related PRs

Suggested labels

ignore-sensitive-files-pr, test

Suggested reviewers

  • palisadoes
  • AVtheking

Poem

🐰 A rabbit's tale of code so bright,
Styling changes taking flight,
Colors shift from green to black,
Figma's guide we now track,
With each commit, our design takes might! 🎨

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (3)
.husky/pre-commit (1)

Line range hint 1-8: Unauthorized modification of git hooks detected.

The pre-commit hook is a sensitive file that affects the entire team's workflow. Modifications to this file should follow the team's change management process.

Please:

  1. Revert changes to the pre-commit hook
  2. Discuss the proposed linting strategy changes with the team
  3. Follow the proper process for modifying shared development tools
🧰 Tools
🪛 GitHub Actions: PR Workflow

[error] Unauthorized modification or deletion of sensitive file

src/components/CheckIn/TableRow.tsx (1)

Line range hint 76-83: Remove code coverage exclusions and add proper tests.

The istanbul ignore next statements are bypassing code coverage requirements. Instead of excluding these lines from coverage, we should add proper tests.

Please:

  1. Remove the istanbul ignore next statements
  2. Add unit tests covering the PDF generation logic, including:
    • Blob creation
    • URL creation
    • Window opening
    • Success notification

Consider using a test utility like jest-mock-window to properly test window operations.

🧰 Tools
🪛 GitHub Actions: PR Workflow

[error] Contains code coverage disable statement. Please remove it and add the appropriate tests.

src/components/LeftDrawer/LeftDrawer.tsx (1)

Line range hint 128-131: Inconsistent icon color scheme.

The SettingsIcon still uses white stroke color while other icons have been updated to use black.

Apply this fix to maintain consistency:

                      <SettingsIcon
                        stroke={`${
                          isActive === true
-                            ? 'var(--bs-white)'
+                            ? 'var(--bs-black)'
                            : 'var(--bs-secondary)'
                        }`}
                      />
🧹 Nitpick comments (6)
src/components/CollapsibleDropdown/CollapsibleDropdown.tsx (1)

46-46: Style updates align with Figma guidelines.

The color scheme changes from white to black text improve contrast and follow the style guide.

Consider adding a comment documenting the style guide reference for these color choices to help future maintainers understand the design decisions.

Also applies to: 54-54, 60-60

src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (3)

124-129: Consider using React.Fragment shorthand.

The explicit fragment syntax can be simplified.

-            <>
-              <button
-                className={`${styles.profileContainer} shimmer`}
-                data-testid="orgBtn"
-              />
-            </>
+            <button
+              className={`${styles.profileContainer} shimmer`}
+              data-testid="orgBtn"
+            />

177-183: Improve boolean comparison in conditional styling.

The strict equality comparison with true is redundant.

-                    variant={isActive === true ? 'success' : ''}
-                    style={{
-                      backgroundColor: isActive === true ? '#EAEBEF' : '',
-                    }}
-                    className={`${
-                      isActive === true ? 'text-black' : 'text-secondary'
-                    }`}
+                    variant={isActive ? 'success' : ''}
+                    style={{
+                      backgroundColor: isActive ? '#EAEBEF' : '',
+                    }}
+                    className={`${
+                      isActive ? 'text-black' : 'text-secondary'
+                    }`}

189-191: Consider extracting color values to CSS variables.

Hard-coded color values should be moved to CSS variables for better maintainability and consistency with the Figma style guide.

-                          isActive === true
-                            ? 'var(--bs-black)'
-                            : 'var(--bs-secondary)'
+                          isActive
+                            ? 'var(--icon-active-color, var(--bs-black))'
+                            : 'var(--icon-inactive-color, var(--bs-secondary))'
src/screens/OrganizationPeople/AddMember.tsx (1)

550-550: Consider responsive button width.

Setting a fixed 100% width might not be optimal for all screen sizes.

-                width: '100%',
+                width: 'min(100%, 300px)',
+                margin: '0 auto',
src/assets/css/app.css (1)

14073-14103: Custom button styles properly override Bootstrap defaults.

The custom styles effectively:

  1. Override Bootstrap's default success button appearance
  2. Add smooth transitions for icon colors
  3. Maintain consistent hover/active states

However, consider adding comments to explain why these overrides are necessary for future maintainers.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 197092f and ba82b69.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • .eslintrc.json (2 hunks)
  • .husky/pre-commit (1 hunks)
  • package.json (4 hunks)
  • src/assets/css/app.css (8 hunks)
  • src/components/CheckIn/TableRow.tsx (1 hunks)
  • src/components/CollapsibleDropdown/CollapsibleDropdown.tsx (3 hunks)
  • src/components/LeftDrawer/LeftDrawer.tsx (2 hunks)
  • src/components/LeftDrawerOrg/LeftDrawerOrg.module.css (1 hunks)
  • src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (4 hunks)
  • src/screens/OrgList/OrgList.tsx (1 hunks)
  • src/screens/OrganizationPeople/AddMember.tsx (3 hunks)
  • src/screens/OrganizationPeople/OrganizationPeople.tsx (6 hunks)
  • src/style/app.module.css (9 hunks)
👮 Files not reviewed due to content moderation or server errors (4)
  • .eslintrc.json
  • package.json
  • src/components/LeftDrawerOrg/LeftDrawerOrg.module.css
  • src/style/app.module.css
🧰 Additional context used
🪛 GitHub Actions: PR Workflow
.husky/pre-commit

[error] Unauthorized modification or deletion of sensitive file

src/components/CheckIn/TableRow.tsx

[error] Contains code coverage disable statement. Please remove it and add the appropriate tests.

package.json

[error] Unauthorized modification or deletion of sensitive file

.eslintrc.json

[error] Unauthorized modification or deletion of sensitive file

🪛 Biome (1.9.4)
src/style/app.module.css

[error] 519-519: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 520-520: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)

🔇 Additional comments (11)
src/components/CollapsibleDropdown/CollapsibleDropdown.tsx (1)

77-77: Consistent styling in sub-targets.

The color scheme changes are consistently applied to sub-targets, maintaining visual hierarchy.

Also applies to: 91-91

src/components/LeftDrawer/LeftDrawer.tsx (1)

99-99: Style updates align with Figma guidelines.

The color scheme changes for text and RolesIcon follow the style guide.

Also applies to: 107-107, 121-121

src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (1)

14-14: LGTM! Improved CSS modularity.

The change from global CSS to CSS modules enhances style encapsulation and prevents naming conflicts.

src/screens/OrganizationPeople/OrganizationPeople.tsx (1)

424-433: LGTM! Improved table styling.

The removal of borders aligns with the Figma style guide and creates a cleaner visual presentation.

src/screens/OrgList/OrgList.tsx (1)

Line range hint 365-374: LGTM! Proper access control implementation.

The conditional rendering of the create organization button based on superAdmin status follows security best practices.

src/screens/OrganizationPeople/AddMember.tsx (1)

438-440: LGTM! Improved modal close handling.

Direct use of the close function improves code clarity.

src/assets/css/app.css (5)

2481-2483: Form control focus styles aligned with Figma guide.

The focus state styles have been updated to use the correct brand colors.


3502-3510: Primary button styles updated for visual consistency.

The primary button colors have been updated to use a cohesive blue color scheme, improving visual harmony.


3536-3549: Verify success button color scheme change.

The success button has been changed from traditional green to a gray color scheme (#eaebef). While this matches the Figma design, please verify that this change:

  1. Aligns with user expectations for success/confirmation actions
  2. Maintains sufficient contrast for accessibility

3587-3591: Danger button styling refined.

The danger button now uses a softer red palette while maintaining clear error/danger signaling.


6106-6106: Close button focus state aligned with global focus styles.

The close button focus shadow now matches other focus states in the application.

Comment on lines 211 to 213
display: `${styles.profileImage.search('flex') === -1 ? 'flex' : ''}`,
justifyContent: `${styles.profileImage.search('center') === -1 ? 'center' : ''}`,
alignItems: `${styles.profileImage.search('center') === -1 ? 'center' : ''}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Simplify conditional style checks.

The string search operations for style checks are inefficient and hard to maintain.

-              display: `${styles.profileImage.search('flex') === -1 ? 'flex' : ''}`,
-              justifyContent: `${styles.profileImage.search('center') === -1 ? 'center' : ''}`,
-              alignItems: `${styles.profileImage.search('center') === -1 ? 'center' : ''}`,
+              display: 'flex',
+              justifyContent: 'center',
+              alignItems: 'center',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
display: `${styles.profileImage.search('flex') === -1 ? 'flex' : ''}`,
justifyContent: `${styles.profileImage.search('center') === -1 ? 'center' : ''}`,
alignItems: `${styles.profileImage.search('center') === -1 ? 'center' : ''}`,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',

Comment on lines +181 to +195
{
field: 'rowNumber',
headerName: '#',
minWidth: 80,
align: 'center',
headerAlign: 'center',
headerClassName: `${styles.tableHeader}`,
sortable: false,
renderCell: (params: GridCellParams) => {
// Use params.api.getSortedRowIds() or params.rowIndex to generate row numbers
const sortedRowIds = params.api.getSortedRowIds(); // Get sorted row IDs
const rowIndex = sortedRowIds.indexOf(params.id); // Find the index of the current row
return <div>{rowIndex + 1}</div>;
},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Optimize row number calculation.

The current implementation recalculates sorted row IDs for each cell render, which could impact performance with large datasets.

-      renderCell: (params: GridCellParams) => {
-        const sortedRowIds = params.api.getSortedRowIds(); // Get sorted row IDs
-        const rowIndex = sortedRowIds.indexOf(params.id); // Find the index of the current row
-        return <div>{rowIndex + 1}</div>;
-      },
+      renderCell: (params: GridCellParams) => {
+        return <div>{params.api.getRowIndex(params.id) + 1}</div>;
+      },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
field: 'rowNumber',
headerName: '#',
minWidth: 80,
align: 'center',
headerAlign: 'center',
headerClassName: `${styles.tableHeader}`,
sortable: false,
renderCell: (params: GridCellParams) => {
// Use params.api.getSortedRowIds() or params.rowIndex to generate row numbers
const sortedRowIds = params.api.getSortedRowIds(); // Get sorted row IDs
const rowIndex = sortedRowIds.indexOf(params.id); // Find the index of the current row
return <div>{rowIndex + 1}</div>;
},
},
{
field: 'rowNumber',
headerName: '#',
minWidth: 80,
align: 'center',
headerAlign: 'center',
headerClassName: `${styles.tableHeader}`,
sortable: false,
renderCell: (params: GridCellParams) => {
return <div>{params.api.getRowIndex(params.id) + 1}</div>;
},
},

Comment on lines 101 to 113
const [createNewUserModalisOpen1, setCreateNewUserModalIsOpen1] =
useState(false);

// Function to open the modal
function openCreateNewUserModal1(): void {
setCreateNewUserModalIsOpen(true);
}

// Function to close the modal
function closeCreateNewUserModal1(): void {
setCreateNewUserModalIsOpen(false);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consolidate duplicate modal state management.

There are multiple similar modal state management implementations that could be consolidated.

Consider creating a custom hook for modal management:

function useModal(initialState = false) {
  const [isOpen, setIsOpen] = useState(initialState);
  const open = useCallback(() => setIsOpen(true), []);
  const close = useCallback(() => setIsOpen(false), []);
  const toggle = useCallback(() => setIsOpen(prev => !prev), []);
  
  return { isOpen, open, close, toggle };
}

Then use it like this:

-  const [createNewUserModalisOpen1, setCreateNewUserModalIsOpen1] = useState(false);
-  function openCreateNewUserModal1(): void {
-    setCreateNewUserModalIsOpen(true);
-  }
-  function closeCreateNewUserModal1(): void {
-    setCreateNewUserModalIsOpen(false);
-  }
+  const { isOpen: createNewUserModalIsOpen1, open: openCreateNewUserModal1, close: closeCreateNewUserModal1 } = useModal();

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
src/screens/OrganizationPeople/OrganizationPeople.tsx (1)

181-195: 🛠️ Refactor suggestion

Optimize row number calculation.

The current implementation recalculates sorted row IDs for each cell render, which could impact performance with large datasets.

Apply this diff to optimize the row number calculation:

-      renderCell: (params: GridCellParams) => {
-        // Use params.api.getSortedRowIds() or params.rowIndex to generate row numbers
-        const sortedRowIds = params.api.getSortedRowIds(); // Get sorted row IDs
-        const rowIndex = sortedRowIds.indexOf(params.id); // Find the index of the current row
-        return <div>{rowIndex + 1}</div>;
-      },
+      renderCell: (params: GridCellParams) => {
+        return <div>{params.api.getRowIndex(params.id) + 1}</div>;
+      },
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba82b69 and 0a7f31e.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • .husky/pre-commit (0 hunks)
  • src/screens/EventManagement/EventManagement.tsx (1 hunks)
  • src/screens/OrganizationPeople/AddMember.tsx (5 hunks)
  • src/screens/OrganizationPeople/OrganizationPeople.tsx (7 hunks)
💤 Files with no reviewable changes (1)
  • .husky/pre-commit
🧰 Additional context used
🪛 eslint
src/screens/OrganizationPeople/AddMember.tsx

[error] 100-100: Missing return type on function.

(@typescript-eslint/explicit-function-return-type)


[error] 110-110: 'createNewUserModalIsOpen1' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)


[error] 111-111: 'openCreateNewUserModal1' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)

src/screens/OrganizationPeople/OrganizationPeople.tsx

[error] 25-25: 'react-bootstrap' imported multiple times.

(import/no-duplicates)


[error] 26-26: '@mui/icons-material' imported multiple times.

(import/no-duplicates)

🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/screens/OrganizationPeople/AddMember.tsx

[failure] 100-100:
Missing return type on function


[failure] 110-110:
'createNewUserModalIsOpen1' is assigned a value but never used


[failure] 111-111:
'openCreateNewUserModal1' is assigned a value but never used

src/screens/OrganizationPeople/OrganizationPeople.tsx

[failure] 25-25:
'/home/runner/work/talawa-admin/talawa-admin/node_modules/react-bootstrap/esm/index.js' imported multiple times


[failure] 26-26:
'/home/runner/work/talawa-admin/talawa-admin/node_modules/@mui/icons-material/esm/index.js' imported multiple times

🪛 GitHub Actions: PR Workflow
src/screens/OrganizationPeople/AddMember.tsx

[error] 2-2: 'Close' is defined but never used

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (6)
src/screens/EventManagement/EventManagement.tsx (1)

108-114: LGTM! Type safety improvement.

The addition of the Params type and its usage with useParams hook enhances type safety for URL parameters.

src/screens/OrganizationPeople/OrganizationPeople.tsx (3)

204-204: LGTM! Improved profile image styling.

The changes improve maintainability by:

  • Using CSS classes instead of inline styles
  • Using the Avatar component as a fallback for missing profile images

Also applies to: 220-220, 223-226


424-433: LGTM! Cleaner DataGrid styling.

The removal of borders between rows, cells, and headers creates a cleaner visual presentation.


341-395: LGTM! Enhanced sorting functionality.

The new dropdown component provides a better user experience for sorting with:

  • Clear options for users, members, and admins
  • Consistent styling and accessibility attributes
src/screens/OrganizationPeople/AddMember.tsx (2)

550-550: LGTM! Improved button styling.

Setting the button width to 100% improves visual consistency and usability.


438-438: ⚠️ Potential issue

Fix modal close handler.

The modal is using closeCreateNewUserModal1 which is an unused variable.

Apply this diff to fix the modal close handler:

-        onHide={closeCreateNewUserModal1} // Use the close function directly
+        onHide={closeCreateNewUserModal}

Likely invalid or redundant comment.

Comment on lines 25 to 26
import { Dropdown } from 'react-bootstrap';
import { Sort } from '@mui/icons-material';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove duplicate imports.

Consolidate the duplicate imports from 'react-bootstrap' and '@mui/icons-material'.

Apply this diff to fix the imports:

-import { Dropdown } from 'react-bootstrap';
-import { Sort } from '@mui/icons-material';

Then update the existing imports at the top of the file:

-import { Delete, Search } from '@mui/icons-material';
+import { Delete, Search, Sort } from '@mui/icons-material';
-import { Button, Form } from 'react-bootstrap';
+import { Button, Dropdown, Form } from 'react-bootstrap';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { Dropdown } from 'react-bootstrap';
import { Sort } from '@mui/icons-material';
// Remove these lines entirely as they are duplicate imports
🧰 Tools
🪛 eslint

[error] 25-25: 'react-bootstrap' imported multiple times.

(import/no-duplicates)


[error] 26-26: '@mui/icons-material' imported multiple times.

(import/no-duplicates)

🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch

[failure] 25-25:
'/home/runner/work/talawa-admin/talawa-admin/node_modules/react-bootstrap/esm/index.js' imported multiple times


[failure] 26-26:
'/home/runner/work/talawa-admin/talawa-admin/node_modules/@mui/icons-material/esm/index.js' imported multiple times

Comment on lines 100 to 107
function useModal(initialState = false) {
const [isOpen, setIsOpen] = useState(initialState);
const open = useCallback(() => setIsOpen(true), []);
const close = useCallback(() => setIsOpen(false), []);
const toggle = useCallback(() => setIsOpen((prev) => !prev), []);

return { isOpen, open, close, toggle };
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add return type annotation to useModal hook.

The hook is well-implemented with memoized functions, but it's missing a return type annotation.

Apply this diff to add the return type:

-function useModal(initialState = false) {
+function useModal(initialState = false): {
+  isOpen: boolean;
+  open: () => void;
+  close: () => void;
+  toggle: () => void;
+} {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function useModal(initialState = false) {
const [isOpen, setIsOpen] = useState(initialState);
const open = useCallback(() => setIsOpen(true), []);
const close = useCallback(() => setIsOpen(false), []);
const toggle = useCallback(() => setIsOpen((prev) => !prev), []);
return { isOpen, open, close, toggle };
}
function useModal(initialState = false): {
isOpen: boolean;
open: () => void;
close: () => void;
toggle: () => void;
} {
const [isOpen, setIsOpen] = useState(initialState);
const open = useCallback(() => setIsOpen(true), []);
const close = useCallback(() => setIsOpen(false), []);
const toggle = useCallback(() => setIsOpen((prev) => !prev), []);
return { isOpen, open, close, toggle };
}
🧰 Tools
🪛 eslint

[error] 100-100: Missing return type on function.

(@typescript-eslint/explicit-function-return-type)

🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch

[failure] 100-100:
Missing return type on function

Comment on lines 109 to 113
const {
isOpen: createNewUserModalIsOpen1,
open: openCreateNewUserModal1,
close: closeCreateNewUserModal1,
} = useModal();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix unused variables from useModal hook.

The destructured values from useModal are not used in the component, which may indicate incomplete refactoring.

Either:

  1. Remove the unused hook call:
-const {
-  isOpen: createNewUserModalIsOpen1,
-  open: openCreateNewUserModal1,
-  close: closeCreateNewUserModal1,
-} = useModal();

Or:
2. Complete the refactoring by replacing the existing state management:

-const [createNewUserModalisOpen, setCreateNewUserModalIsOpen] = useState(false);
-function openCreateNewUserModal(): void {
-  setCreateNewUserModalIsOpen(true);
-}
-function closeCreateNewUserModal(): void {
-  setCreateNewUserModalIsOpen(false);
-}
-const toggleCreateNewUserModal = (): void =>
-  setCreateNewUserModalIsOpen(!addUserModalisOpen);

With the useModal hook:

+const {
+  isOpen: createNewUserModalisOpen,
+  open: openCreateNewUserModal,
+  close: closeCreateNewUserModal,
+  toggle: toggleCreateNewUserModal,
+} = useModal();

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 eslint

[error] 110-110: 'createNewUserModalIsOpen1' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)


[error] 111-111: 'openCreateNewUserModal1' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)

🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch

[failure] 110-110:
'createNewUserModalIsOpen1' is assigned a value but never used


[failure] 111-111:
'openCreateNewUserModal1' is assigned a value but never used

@palisadoes
Copy link
Contributor

Please exclude the sensitive files from your PR

@abhassen44
Copy link
Author

but all sentives files were written in .gitignore
Screenshot 2025-01-14 193218

@palisadoes
Copy link
Contributor

but all sentives files were written in .gitignore Screenshot 2025-01-14 193218

Not the ones you submitted.

.husky/pre-commit Show resolved Hide resolved
package.json Outdated
"typedoc": "^0.26.10",
"typedoc-plugin-markdown": "^4.2.10",
"typedoc": "^0.27.0",
"typedoc-plugin-markdown": "^4.4.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exclude this file from the PR. It's not a requirement of the issue

@@ -78,7 +78,7 @@
'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas,
'Liberation Mono', 'Courier New', monospace;
--bs-body-color 'Liberation Mono', 'Courier New', monospace;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Exclude this file from the PR. It's not a requirement of the issue
  2. Use CSS exclusively from src/style/app.module.css,

@@ -43,21 +43,21 @@ const collapsibleDropdown = ({
<>
<Button
variant={showDropdown ? 'success' : ''}
className={showDropdown ? 'text-white' : 'text-secondary'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Don't use hard coded colors
  2. Make this file use CSS exclusively from src/style/app.module.css, with the exception of package based CSS.
  3. Delete the CSS file in the directory of this file. Make the file exclusively use CSS from src/style/app.module.css
  4. Use no CSS in assets/css/app.css
  5. This will help with future attempts to having Dark Mode
  6. Use a variable from src/style/app.module.css .
  7. Use a variable name that describes the function of the color and not the color itself. For example --search-button-bg is much better than --light-blue

@@ -43,21 +43,21 @@ const collapsibleDropdown = ({
<>
<Button
variant={showDropdown ? 'success' : ''}
className={showDropdown ? 'text-white' : 'text-secondary'}
className={showDropdown ? 'text-black' : 'text-secondary'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Don't use hard coded colors
  2. Make this file use CSS exclusively from src/style/app.module.css, with the exception of package based CSS.
  3. Delete the CSS file in the directory of this file. Make the file exclusively use CSS from src/style/app.module.css
  4. Use no CSS in assets/css/app.css
  5. This will help with future attempts to having Dark Mode
  6. Use a variable from src/style/app.module.css .
  7. Use a variable name that describes the function of the color and not the color itself. For example --search-button-bg is much better than --light-blue

) : organization == undefined ? (
!isProfilePage && (
<button
className={`${styles.profileContainer} ${styles.bgDanger} text-start text-white`}
className={`${styles.profileContainer} bg-danger text-start text-white`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Make this file use CSS exclusively from src/style/app.module.css, with the exception of package based CSS.
  2. Delete the CSS file in the directory of this file. Make the file exclusively use CSS from src/style/app.module.css
  3. Use no CSS in assets/css/app.css
  4. This will help with future attempts to having Dark Mode
  5. Use a variable from src/style/app.module.css .
  6. Use a variable name that describes the function of the color and not the color itself. For example --search-button-bg is much better than --light-blue

}
variant={isActive === true ? 'success' : ''}
style={{
backgroundColor: isActive === true ? '#EAEBEF' : '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Don't use hard coded colors
  2. Make this file use CSS exclusively from src/style/app.module.css, with the exception of package based CSS.
  3. Delete the CSS file in the directory of this file. Make the file exclusively use CSS from src/style/app.module.css
  4. Use no CSS in assets/css/app.css
  5. This will help with future attempts to having Dark Mode
  6. Use a variable from src/style/app.module.css .
  7. Use a variable name that describes the function of the color and not the color itself. For example --search-button-bg is much better than --light-blue

backgroundColor: isActive === true ? '#EAEBEF' : '',
}}
className={`${
isActive === true ? 'text-black' : 'text-secondary'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Make this file use CSS exclusively from src/style/app.module.css, with the exception of package based CSS.
  2. Delete the CSS file in the directory of this file. Make the file exclusively use CSS from src/style/app.module.css
  3. Use no CSS in assets/css/app.css
  4. This will help with future attempts to having Dark Mode
  5. Use a variable from src/style/app.module.css .
  6. Use a variable name that describes the function of the color and not the color itself. For example --search-button-bg is much better than --light-blue

>
<div className={styles.iconWrapper}>
<IconComponent
name={name == 'Membership Requests' ? 'Requests' : name}
fill={
isActive ? 'var(--bs-black)' : 'var(--bs-secondary)'
isActive === true
? 'var(--bs-black)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Don't use hard coded colors
  2. Make this file use CSS exclusively from src/style/app.module.css, with the exception of package based CSS.
  3. Delete the CSS file in the directory of this file. Make the file exclusively use CSS from src/style/app.module.css
  4. Use no CSS in assets/css/app.css
  5. This will help with future attempts to having Dark Mode
  6. Use a variable from src/style/app.module.css .
  7. Use a variable name that describes the function of the color and not the color itself. For example --search-button-bg is much better than --light-blue

@@ -97,7 +97,20 @@ function AddMember(): JSX.Element {
setCreateNewUserModalIsOpen(!addUserModalisOpen);

const [addMember] = useMutation(ADD_MEMBER_MUTATION);
function useModal(initialState = false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Make this file use CSS exclusively from src/style/app.module.css, with the exception of package based CSS.
  2. Delete the CSS file in the directory of this file. Make the file exclusively use CSS from src/style/app.module.css
  3. Use no CSS in assets/css/app.css
  4. This will help with future attempts to having Dark Mode
  5. Use a variable from src/style/app.module.css .
  6. Use a variable name that describes the function of the color and not the color itself. For example --search-button-bg is much better than --light-blue

@palisadoes
Copy link
Contributor

palisadoes commented Jan 18, 2025

  1. Please fix the conflicting files
  2. Make CodeRabbit.ai approve your changes
  3. Please fix the failing tests

Copy link
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue states to consolidate CSS into a single file (only for the files you edit:

image

Copy link
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Use CSS exclusively from src/style/app.module.css
    image

@palisadoes
Copy link
Contributor

There are other issues. Let's start with fixing these

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (5)
src/screens/OrganizationPeople/AddMember.tsx (1)

540-540: Move inline styles to CSS module.

Move the width style to src/style/app.module.css to maintain consistency and improve maintainability.

-                width: '100%',
+                className: styles.fullWidth,

Add to src/style/app.module.css:

.fullWidth {
  width: 100%;
}
src/style/app.module.css (2)

121-122: Consider simplifying the shadow definition.

The multi-line shadow definition could be more maintainable by using separate variables for each shadow component.

-  --input-shadow-color: 4px 4px 10px -1px rgb(168, 168, 168, 0.7),
-    /* Shadow on bottom-right */ 2px 2px 10px -1px rgba(169, 169, 169, 0.7); /* Lighter shadow on bottom-right */
+  --input-shadow-primary: 4px 4px 10px -1px rgb(168, 168, 168, 0.7);
+  --input-shadow-secondary: 2px 2px 10px -1px rgba(169, 169, 169, 0.7);
+  --input-shadow-color: var(--input-shadow-primary), var(--input-shadow-secondary);

Line range hint 1440-1450: Use CSS variables for breakpoints consistently.

The file defines breakpoint variables but doesn't use them consistently in media queries. Consider using the defined variables for better maintainability.

-@media (max-width: 1440px) {
+@media (max-width: var(--breakpoint-desktop)) {
   .contractOrgList {
     padding-left: calc(250px + 2rem + 1.5rem);
   }
 
   .listBoxOrgList .itemCardOrgList {
     width: 100%;
   }
 }
.github/workflows/scripts/eslint_disable_check.py (2)

51-57: Consider enhancing error handling with proper logging.

While the error handling is functional, consider using Python's logging module for better error tracking and consistency.

+import logging
+
+logging.basicConfig(level=logging.INFO)
+logger = logging.getLogger(__name__)
+
 def has_eslint_disable(file_path):
     try:
         with open(file_path, "r", encoding="utf-8") as file:
             content = file.read()
             return bool(eslint_disable_pattern.search(content))
     except FileNotFoundError:
-        print(f"File not found: {file_path}")
+        logger.error("File not found: %s", file_path)
     except PermissionError:
-        print(f"Permission denied: {file_path}")
+        logger.error("Permission denied: %s", file_path)
     except (IOError, OSError) as e:
-        print(f"Error reading file {file_path}: {e}")
+        logger.error("Error reading file %s: %s", file_path, e)

74-77: Simplify file extension checking.

The file extension checking can be made more concise using tuple unpacking.

-            if item.endswith((".ts", ".tsx")) and has_eslint_disable(item):
-                print(f"Error: File {item} contains eslint-disable statements.")
-                eslint_found = True
+            if item.endswith((".ts", ".tsx")):
+                if has_eslint_disable(item):
+                    print(f"Error: File {item} contains eslint-disable statements.")
+                    eslint_found = True
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a7f31e and a077c6c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • .github/workflows/pull-request.yml (1 hunks)
  • .github/workflows/scripts/eslint_disable_check.py (4 hunks)
  • matrix.txt (1 hunks)
  • package.json (1 hunks)
  • src/screens/OrganizationPeople/AddMember.tsx (12 hunks)
  • src/screens/OrganizationPeople/OrganizationPeople.tsx (7 hunks)
  • src/style/app.module.css (11 hunks)
✅ Files skipped from review due to trivial changes (1)
  • matrix.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/screens/OrganizationPeople/OrganizationPeople.tsx
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 198-198: syntax error: expected , but found ''

(syntax)

🪛 eslint
src/screens/OrganizationPeople/AddMember.tsx

[error] 2-2: 'Check' is defined but never used.

(@typescript-eslint/no-unused-vars)

🪛 Biome (1.9.4)
src/style/app.module.css

[error] 567-567: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 568-568: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)

🔇 Additional comments (6)
src/screens/OrganizationPeople/AddMember.tsx (2)

89-106: Well-implemented modal management hook!

The useModal hook is a great addition that:

  • Uses proper TypeScript return type annotation
  • Implements memoized functions with useCallback
  • Follows the single responsibility principle

431-433: Clean modal header implementation!

Good simplification of the modal close handler by using the hook's close function directly.

src/style/app.module.css (1)

1-38: Well-structured CSS methodology documentation!

The comprehensive documentation clearly outlines:

  • Project goals for reducing CSS duplication
  • Steps for contributors
  • Naming conventions with examples
  • List of global classes
    This will help maintain consistency and reduce technical debt.
.github/workflows/scripts/eslint_disable_check.py (2)

41-43: LGTM: Well-constructed regex pattern.

The pattern correctly handles all variations of eslint-disable comments including single-line, next-line, and multi-line formats.


101-103: LGTM: Clear and concise argument parser description.

The description effectively communicates the script's purpose.

package.json (1)

171-178: This file should be excluded from the PR.

As per the previous review comments, this file should not be included in this PR as it's not a requirement of the issue #3171 which focuses on Figma style guide violations.

@@ -1,5 +1,5 @@
import { useLazyQuery, useMutation, useQuery } from '@apollo/client';
import { Check, Close, Search } from '@mui/icons-material';
import { Check, Search } from '@mui/icons-material';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove unused import.

The Check icon from @mui/icons-material is imported but never used in the component.

-import { Check, Search } from '@mui/icons-material';
+import { Search } from '@mui/icons-material';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { Check, Search } from '@mui/icons-material';
import { Search } from '@mui/icons-material';
🧰 Tools
🪛 eslint

[error] 2-2: 'Check' is defined but never used.

(@typescript-eslint/no-unused-vars)

Comment on lines +39 to +40
backgroundColor: 'var(--grey-light)',
color: 'var(--black-color)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use CSS variables from app.module.css.

Replace hardcoded color variables with appropriate variables from src/style/app.module.css to maintain consistency with the Figma style guide and support future dark mode implementation.

-    backgroundColor: 'var(--grey-light)',
-    color: 'var(--black-color)',
+    backgroundColor: 'var(--table-header-bg)',
+    color: 'var(--table-header-text)',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
backgroundColor: 'var(--grey-light)',
color: 'var(--black-color)',
backgroundColor: 'var(--table-header-bg)',
color: 'var(--table-header-text)',

Comment on lines +565 to +571
.profileImage {
display: flex;
justifycontent: center;
alignitems: center;
height: 100%;
width: 100%;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix invalid CSS properties.

The properties justifycontent and alignitems are invalid. They should be hyphenated.

 .profileImage {
   display: flex;
-  justifycontent: center;
-  alignitems: center;
+  justify-content: center;
+  align-items: center;
   height: 100%;
   width: 100%;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.profileImage {
display: flex;
justifycontent: center;
alignitems: center;
height: 100%;
width: 100%;
}
.profileImage {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 567-567: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)


[error] 568-568: Unknown property is not allowed.

See CSS Specifications and browser specific properties for more details.
To resolve this issue, replace the unknown property with a valid CSS property.

(lint/correctness/noUnknownProperty)

Comment on lines +205 to +207
if: steps.filter-files.outputs.ts_files != ''
run: |
python .github/workflows/scripts/eslint_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
python .github/workflows/scripts/eslint_disable_check.py --files ${{ steps.filter-files.outputs.ts_files }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improve conditional execution formatting.

The indentation of the if condition is incorrect, which could cause workflow failures.

-      if: steps.filter-files.outputs.ts_files != ''
+      if: ${{ steps.filter-files.outputs.ts_files != '' }}
        run: |
          python .github/workflows/scripts/eslint_disable_check.py --files ${{ steps.filter-files.outputs.ts_files }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if: steps.filter-files.outputs.ts_files != ''
run: |
python .github/workflows/scripts/eslint_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
python .github/workflows/scripts/eslint_disable_check.py --files ${{ steps.filter-files.outputs.ts_files }}
if: ${{ steps.filter-files.outputs.ts_files != '' }}
run: |
python .github/workflows/scripts/eslint_disable_check.py --files ${{ steps.filter-files.outputs.ts_files }}

Comment on lines +198 to +202
- name: Filter TypeScript files
id: filter-files
run: |
echo "ts_files=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | tr ',' '\n' | grep -E '\.(ts|tsx)$' | tr '\n' ' ')" >> $GITHUB_OUTPUT
shell: bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix YAML syntax error and improve file filtering.

There's a syntax error in the YAML structure. Additionally, the file filtering could be more robust.

Apply this diff to fix the syntax and improve the filtering:

      - name: Filter TypeScript files
        id: filter-files
        run: |
-          echo "ts_files=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | tr ',' '\n' | grep -E '\.(ts|tsx)$' | tr '\n' ' ')" >> $GITHUB_OUTPUT
+          ts_files=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | tr ',' '\n' | grep -E '\.(ts|tsx)$' | tr '\n' ' ')
+          if [ -n "$ts_files" ]; then
+            echo "ts_files=$ts_files" >> $GITHUB_OUTPUT
+          fi
        shell: bash
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Filter TypeScript files
id: filter-files
run: |
echo "ts_files=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | tr ',' '\n' | grep -E '\.(ts|tsx)$' | tr '\n' ' ')" >> $GITHUB_OUTPUT
shell: bash
- name: Filter TypeScript files
id: filter-files
run: |
ts_files=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | tr ',' '\n' | grep -E '\.(ts|tsx)$' | tr '\n' ' ')
if [ -n "$ts_files" ]; then
echo "ts_files=$ts_files" >> $GITHUB_OUTPUT
fi
shell: bash
🧰 Tools
🪛 yamllint (1.35.1)

[error] 198-198: syntax error: expected , but found ''

(syntax)

@palisadoes
Copy link
Contributor

  1. This has to be closed.
  2. There are too many conflicting files.
  3. Many files are outside of the scope of the PR, especially package*json and files in the .github/ directory

Please merge your code with the latest upstream, and resubmit

@palisadoes palisadoes closed this Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants